Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(zeroize): added zeorizing to Felt #100

Merged
merged 5 commits into from
Mar 26, 2025
Merged

Conversation

Trantorian1
Copy link
Contributor

This is feature-gated behind the zeroing flag

Pull Request type

  • Feature

What is the current behavior?

Felt provides no option to zeroize its memory, which can be an issue when dealing with sensitive cryptographic information such as private keys.

Resolves: #99

What is the new behavior?

  • Implemented zeroizing for Felt through the zeroize crate. While zeroize is not used directly, Felt implements manually the Zeroize trait in the hopes of making this behavior more 'standard'. This has been gated behind the zeroing feature.

Note

Contrarily to zeroize, this is done using safe rust by leveraging core::mem::take to replace the in-memory representation of a felt with its default value of Felt::ZERO.

Does this introduce a breaking change?

No. While the zeroing feature has been added to default, zeroing has not been implemented on drop, both because this would interfere with the Copy trait of Felt but also because it seems like it should be up to the end user to determine when they are dealing with sensitive information.

This is feature-gated behind the `zeroing` flag
@jbcaron jbcaron added the enhancement New feature or request label Feb 5, 2025
@tdelabro
Copy link
Collaborator

@pefontana @dan-starkware @maciejka @0xLucqs can we get a second review?

@Trantorian1 Trantorian1 requested a review from 0xLucqs March 26, 2025 07:53
@Trantorian1
Copy link
Contributor Author

Trantorian1 commented Mar 26, 2025

Applied your suggestions @0xLucqs, thanks for catching that!

@tdelabro tdelabro merged commit 67468ff into starknet-io:main Mar 26, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(felt): Felt is not zeroized on drop
4 participants